/**
 * @date 5:54:30 PM
 * MessageAPIService.java
 * Administrator
 * TODO
 */
package com.qs.education.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.qs.education.bean.api.PageBean;
import com.qs.education.bean.api.ResponseBean;
import com.qs.education.bean.entity.EducationStudent;
import com.qs.education.bean.entity.EducationStudentMessage;
import com.qs.education.bean.entity.EducationTeacher;
import com.qs.education.bean.entity.EducationTeacherMessage;
import com.qs.education.bean.service.BaseService;
import com.qs.education.service.IMessageAPIService;
/**
 * @class MessageAPIService	
 * @author Warren
 * @description
 * @date Nov 9, 2018 
 */			
@Service
public class MessageAPIServiceImpl extends BaseService implements IMessageAPIService{

	/**
	 * @author Warren
	 * @param studentId
	 * @param currentPage
	 * @param pageNum
	 * @return PageBean
	 * @description 根据页码、页数量、id查询学生的消息列表
	 * @date Nov 21, 2018
	 */
	@Override
	public PageBean getALLMessageByStudentId(Long studentId,int currentPage,int pageSize) {
		EducationStudent educationStudent = iEducationStudentDao.get(EducationStudent.class, studentId);
		List<EducationStudentMessage> list = iEducationStudentMessageDao.findListByStudent(educationStudent, currentPage, pageSize);
		int recordCount = iEducationStudentMessageDao.getALLCountByStudent(educationStudent);
		PageBean pageBean = new PageBean(currentPage, pageSize, recordCount, list);
		return pageBean;
	}

	/**
	 * @author Warren
	 * @param teacherId
	 * @param currentPage
	 * @param pageSize
	 * @return PageBean
	 * @description 根据页码、页数量、id查询教师的消息列表
	 * @date Nov 21, 2018
	 */
	@Override
	public PageBean getALLMessageByTeacherId(String teacherId,int currentPage,int pageSize) {
		EducationTeacher educationTeacher = iEducationTeacherDao.get(EducationTeacher.class, Integer.parseInt(teacherId));
		List<EducationTeacherMessage> list = iEducationTeacherMessageDao.findListByTeacher(educationTeacher, currentPage, pageSize);
		int recordCount = iEducationTeacherMessageDao.getALLCountByTeacher(educationTeacher);
		PageBean pageBean = new PageBean(currentPage, pageSize, recordCount, list);
		return pageBean;
	}
	
	/**
	 * @author Warren
	 * @return ResponseBean
	 * @description 根据id删除消息
	 * @date Nov 20, 2018
	 */
	@Override
	public ResponseBean deleteMessageById(Long id) {
		return null;
	}
}
